package top.infopub.job.mkt.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.infopub.generic.GenericDao;
import top.infopub.generic.GenericServiceImpl;
import top.infopub.job.mkt.dao.BidOpenResultDao;
import top.infopub.job.mkt.service.BidOpenResultService;
import top.infopub.model.mkt.BidOpenResult;

import java.util.List;

@Service
public class BidOpenResultServiceImpl extends GenericServiceImpl<BidOpenResult, String> implements
		BidOpenResultService {
	private static final Logger log = LoggerFactory.getLogger(BidOpenResultServiceImpl.class);

	@Autowired
	private BidOpenResultDao bidOpenResultDao;

	@Override
	public GenericDao<BidOpenResult, String> getDao() {
		return bidOpenResultDao;
	}

	@Override
	public void openBid() {
		List<BidOpenResult> list = bidOpenResultDao.queryUnopenList();
		if (list == null) {
			log.info("未查询到可开标的记录~");
		}
		log.info("查询到未开标记录条数：" + list.size());
		for (BidOpenResult bor : list) {
			if (bor == null) continue;
			bidOpenResultDao.modifyBiddingStatus("1", bor.getId());
		}
	}
}